﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class zmd : MonoBehaviour {
    GameObject[] zmds= new GameObject[3];
    static int index = 0;
	// Use this for initialization
	void Start () {
         zmds[0]= transform.Find("bzd").gameObject;
         zmds[1]= transform.Find("ygd").gameObject;
         zmds[2]= transform.Find("led").gameObject;
         zmds[0].SetActive(true);
	}
	
	// Update is called once per frame
	void Update () {
		
	}

   public void next_page() {
        index++;
        if (index> 2)
        {
            index = 0;
        }
        ChangePage(index);
    }

  public  void pre_page() {
        index--;
        if (index < 0)
        {
            index = 2;           
        }
        ChangePage(index);
    }

    void ChangePage(int index)
    {
        for (int i = 0; i < 3; i++)
        {
            if (i == index)
            {
                zmds[i].SetActive(true);
            }
            else
            {
                zmds[i].SetActive(false);
            }
        }
    }
}
